<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>D3</title>
	<script type="text/javascript" src="jquery.min.js"></script>
	<script>
        function test(){
        	var temp=[2,12,7,5,2,8,9,5,6,4];      	
        	for( var i = 1 ; i <= temp.length ; i ++ ){
        		var subNode = document.createElement('div');
				document.getElementById("root").appendChild(subNode);
				subNode.setAttribute('id', i);
				subNode.setAttribute('style', 'background-color: #d0e4fe;color: #d0e4fe; margin:5px;');
				var myDate = new Date();
				subNode.innerHTML = myDate.toLocaleDateString(); //获取当前时间
            	var gridCell = $('#'+i);
            	gridCell.css('width', temp[i-1]*50);
        	}
		}
	</script>
</head>
<body onload="test()">
	<div id="root">
	</div>
</body>
</html>